package com.finance.report.service;


import com.finance.framework.lang.Page;
import com.finance.framework.lang.PageResultBO;
import com.finance.report.bean.pojo.OrganizationSalary;
import com.finance.report.dao.OrganizationSalaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OrganizationSalaryService implements IOrganizationSalaryService {
	@Autowired
	private OrganizationSalaryMapper organizationSalaryMapper;


	@Override
	public PageResultBO<OrganizationSalary> listByPage(Page page) {
		PageResultBO<OrganizationSalary> pageResultBO=new PageResultBO<OrganizationSalary>();
		List<OrganizationSalary>list=organizationSalaryMapper.listByPage(page);
		pageResultBO.setTotalRecord(page.getTotalRecord());
		pageResultBO.setPageSize(page.getPageSize());
		pageResultBO.setPageNo(page.getPageNo());
		pageResultBO.setDataList(list);
		return pageResultBO;
	}

	@Override
	public OrganizationSalary getOrganizationSalaryByOrgCode(String orgCode,String month) {
		return this.organizationSalaryMapper.getByOrgCode(orgCode,month);
	}

	@Override
	public boolean addOrganizationSalary(OrganizationSalary organizationSalary) {
		return organizationSalaryMapper.addOrganizationSalary(organizationSalary)==1;
	}

	@Override
	public boolean updateOrganizationSalary(OrganizationSalary organizationSalary) {
		return organizationSalaryMapper.updateOrganizationSalary(organizationSalary)==1;
	}

	@Override
	public boolean deleteByMonth(String month) {
		return organizationSalaryMapper.deleteByMonth(month)>=0;
	}
}
